import { getSupplierSearchList } from '@/api/basicData/supplier/supplier.js'

export const supplierSelect = {
  data() {
    return {
      // 供应商列表表头信息
      supplierTableKeys: [
        {
          width: 200,
          key: 'supplierName',
          title: '供应商名称'
        },
        {
          width: 200,
          key: 'contactName',
          title: '联系人名称'
        },
        {
          width: 200,
          key: 'phone',
          title: '联系人电话'
        }
      ]
    }
  },
  methods: {
    /*    弹窗组件自定义事件    */
    getSupplierSearchList({ pageNum, pageSize, keyWord }) {
      // 查询列表
      getSupplierSearchList({
        pageNum, pageSize, keyWord
      }).then(resp => {
        let supplierList = resp.rows || []
        let total = resp.total
        // 数据回传
        this.$refs.SupplierSearch.receive(supplierList, total)
      })
    },
    updateQueryParamsForSupplier(supplierId) {
      this.form.supplierId = supplierId
    },
    selectDialogItemForSupplier({ supplierName }) {
      this.$refs.SupplierSearch.formItemKeyWord = supplierName
    }
  }
}

